<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
	</body>
</html>
<script>
	//存
	//key=value键值对构成
	//会话级别的cookie
	document.cookie = "name=xiaowang";
	document.cookie = "age=18";
	
	//取
	//取出来的是字符串每组键值对用分号+空格分开
	console.log(document.cookie);
	
	//name=xiaowang; age=18
	let strCookie = document.cookie;
	//["name=xiaowang",age=18]; 
	let arrCookie = strCookie.split("; ");
	
	for(let i=0; i<arrCookie.length; i++){
		let item = arrCookie[i].split("=");
		console.log(item[0],item[1]);
	}
	
</script>